<div class="overflow-x-auto">

    <div role="alert" class="alert shadow-lg">
        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info shrink-0 w-6 h-6">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                  d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
        </svg>
        <div>
            <h3 class="font-bold">借阅申请需要借阅审核员审核!</h3>
            <div class="text-xs">您共计 <span class="text-red-500 font-bold">{{ $auditCount }}</span> 条借阅需要审核
            </div>
        </div>
    </div>
    <table class="table table-zebra">
        <!-- head -->
        <thead>
        <tr>
            <th>书籍名称</th>
            <th>借阅时间</th>
            <th>归还时间</th>
            <th>逾期</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        @foreach($data as $item)
            <tr>
                <th class="flex items-center gap-2"><img width="40px" src="{{ $item->book->cover }}"
                                                         alt=""/> {{ $item->book->title }}</th>
                <th> {{ $item->borrow_date }}</th>
                <th> {{ $item->return_date }}</th>
                <th> {{ $item->illegal }}</th>
                <th>
                    @if($item->status == 0)
                        <span class="badge  badge-info">审批中</span>
                    @elseif($item->status==1)
                        <span class="badge badge-error">借阅中</span>
                    @elseif($item->status==2)
                        <span class="badge badge-error">已归还</span>
                    @endif
                </th>
                <th>
                    @if($item->status == 1)
                        <form action="/returnBook" method="post">
                            @csrf
                            <input type="hidden" name="id" value="{{ $item->id }}">
                            <button class="btn btn-xs text-white btn-success">归还</button>
                        </form>
                    @else
                        暂无
                    @endif
                </th>
            </tr>
        @endforeach

        </tbody>
    </table>

    @if(count($data) == 0)
        <div class="mt-10">
            @include('tool.empty')
        </div>
    @endif
    {{ $data->links() }}
</div>
